#pragma once

#include "Singleton.h"
#include "EnginePointer.h"
#include "EngineEntity.h"
#include "ISystemConfiguration.h"
#include "EngineEntityCollection.h"
#include "ProfileLogHandler.h"
#include "XmlSerializer.h"
#include "Engine.h"

class EngineApplication : public Singleton<EngineApplication>
{
public:
	HRESULT Run(EnginePointer<ISystemConfiguration>& configuration, int argc, char* argv[]);
private:
	ProfileLogHandler profileLogHandler;
	EnginePointer<SettingsManager> settings;

	HRESULT InitializeLog();
	HRESULT ReadSettings();
	HRESULT ParseSettings(int argc, char* argv[]);
	HRESULT ReadEntities(EnginePointer<EngineEntityCollection>* entities);
	HRESULT InitializeEngine(EnginePointer<Engine>* engine, EnginePointer<ISystemConfiguration>& configuration);
	HRESULT AddEntities(EnginePointer<Engine>& engine, EnginePointer<EngineEntityCollection>& entities);
	HRESULT RunEngine(EnginePointer<Engine>& engine);
};
